package com.baturu.ford.carvin.dal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: chenjiahao
 * @Time: 2019/12/6
 */
public interface SimpleDAO {

    @Select("SELECT max(cartypeid) FROM qp_cartype_ford_copy")
    int queryCartypeMAXId();

    @Insert({"\n" +
            "insert into ford_parts_cartype (brand,subbrand,carsystem,MJ,partsCode,btrid) \n" +
            "SELECT DISTINCT t.BTRBrand,t.BTRSubBrand,t.CarSystem,t.ProductTime,t1.dealPartsCode,t.BTRID FROM `qp_cartype_ford_copy` t\n" +
            "INNER JOIN ford_carsystem tt on t.CarSystem = tt.carSystem\n" +
            "INNER JOIN ford_epc_car_type ttt on ttt.mark = tt.`name` and ttt.`begin` < concat(t.ProductTime,'99') AND ttt.`end` >CONCAT(t.ProductTime,\"00\")\n" +
            "INNER JOIN ford_epc_parts_detail t1 on t1.carTypeId = ttt.idx and right(t1.`begin`,4)<=t.producttime and left(t1.`dealend`,4)>=t.producttime\n" +
            "where t.CarTypeId>=${s} and t.CarTypeId<${e}"})
    void inster(@Param("s") int s, @Param("e") int e);
}
